﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTO;
using DataService;

using System.Web.Security;

public partial class Login : BasePage
{
    private UserService _service;

    public Login()
    {
        _service = new UserService();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        UserLogin = _service.Login(txtUserName.Value, txtPassword.Value);

        if (UserLogin != null)
        {
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Value, Persist.Checked);
            
        }
        else
        {
            lblMessage.Text = "Invalid credentials. Please try again.";
        }
    }
}